TASK_DIR:=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))

include ../../config.mk

# Inputs
RMD_FILE := $(TASK_DIR)/src/gen_prog_component_importance_table.Rmd
CONFIG_RAW_DATA := $(TASK_DIR)/hand/raw_data.csv

# One of the outputs
OUT_FILE := $(OUT_DIR)/prog_component_importance_up_to_date.tex

$(OUT_FILE): $(RMD_FILE) $(CONFIG_RAW_DATA) $(TABLE_CONFIG)
	@mkdir -p $(OUT_DIR)
	@mkdir -p $(PAPER_OUT_DIR)
	$(R_script) -e "rmarkdown::render(input = '$(RMD_FILE)')"
	@cp $(OUT_DIR)/*up_to_date.tex $(PAPER_OUT_DIR)

.PHONY: all clean
.DEFAULT_GOAL=all

all: $(OUT_FILE)

clean:
	rm -rf $(OUT_DIR)/*up_to_date*
